Core.Test.Logger = function() {
	this.active = false;
	this.arr = [];
};

Core.Test.Logger.prototype = {
	
	/**
	 * Activates the logger.
	 * Clears the existing log.
	 */
	activate: function() {
		this.arr = [];
		this.active = true;
	},
	
	/**
	 * Deactivates the logger.
	 */
	deactivate: function() {
		this.arr = [];
		this.active = false;
	},
	
	/**
	 * Push new message into the log.
	 * @param String message
	 */
	log: function(message) {
		if(this.active) { this.arr.push(message); }
	},
	
	/**
	 * Asserts that the specified log item is as expected.
	 * @param Integer index
	 * @param String message
	 */
	assertLog: function(message, index) {
		Assert.equal(message, this.get(index));
	},
	
	assertContain: function(message) {
		Assert.yes(this.arr.contains(message));
	},
	
	assertNotContain: function(message) {
		Assert.no(this.arr.contains(message));
	},
	
	/**
	 * Asserts that the log array is as expected
	 * @param String[] messages
	 */
	assertFlow: function(messages) {
		Assert.equal(messages, this.arr);
	},

	/**
	 * Assert that the log size is as expected
	 * @param Integer expected
	 */
	assertSize: function(expected) {
		Assert.equal(expected, this.arr.length);
	},
	
	/**
	 * Returns log message coresponding to the given index
	 * @param Integer index - if below 0 returns items from the array end.
	 */
	get: function(index) {
		return (index < 0) ? (this.arr[ this.arr.length + index ]) : (this.arr[ index ]);
	}
};


Core.Test.Logger = new Core.Test.Logger();